# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
 -------------------------------------------------
    File Name:     models.py
    Description:   配置模型
 -------------------------------------------------
 """
from pydantic import BaseModel, Field


class ProjectConfig(BaseModel):
    name: str = Field(default="", description="项目名称")


class RedisConfig(BaseModel):
    """Redis配置模型"""
    host: str = Field(..., description="redis数据库主机地址")
    port: int = Field(default=6379, description="redis端口")
    password: str = Field(default="", description="redis密码")
    database: int = Field(default=0, description="redis数据库编号")
    timeout: int = Field(default=10, description="连接超时时间")


class MySqlConfig(BaseModel):
    """MySQL配置模型"""
    host: str = Field(..., description="Mysql数据库主机地址")
    port: int = Field(default=3306, description="数据库端口")
    username: str = Field(default="root", description="数据库用户名")
    password: str = Field(default="123456", description="数据库密码")
    database: str = Field(..., description="数据库名称")


class LogConfig(BaseModel):
    """Log配置模型"""
    log_save_days: int = Field(default=5, description="日志保存天数")
    log_level: str = Field(default="DEBUG", description="最低日志输出级别")
    log_level_console: str = Field(default="INFO", description="控制台最低日志输出级别")
    log_format: str = Field(default="%(asctime)s %(levelname)-8s %(message)s", description="日志输出格式")
    date_format: str = Field(default="%Y-%m-%d %H:%M:%S", description="日期格式")


class EmailConfig(BaseModel):
    """Email配置模型"""
    smtp_server: str = Field(..., description="邮件服务器地址")
    smtp_port: int = Field(default=25, description="邮件服务器端口")
    sender: str = Field(..., description="发送者邮箱地址")
    password: str = Field(..., description="发送者邮箱密码")
    receiver: list[str] = Field([], description="接收者邮箱列表")
    ssl: bool = Field(default=True, description="是否使用SSL加密")
    send: bool = Field(default=False, description="是否开启发送")


class DingDingConfig(BaseModel):
    """钉钉配置模型"""
    webhook: str = Field(..., description="钉钉机器人WebHook地址")
    proxies_http: str = Field(default="", description="代理地址")
    proxies_https: str = Field(default="", description="代理地址")
    send: bool = Field(default=False, description="是否开启发送")


class FeiShuConfig(BaseModel):
    """飞书配置模型"""
    webhook: str = Field(..., description="飞书机器人WebHook地址")
    proxies_http: str = Field(default="", description="代理地址")
    proxies_https: str = Field(default="", description="代理地址")
    send: bool = Field(default=False, description="是否开启发送")


class WeChatConfig(BaseModel):
    """微信配置模型"""
    webhook: str = Field(..., description="微信机器人WebHook地址")
    proxies_http: str = Field(default="", description="代理地址")
    proxies_https: str = Field(default="", description="代理地址")
    send: bool = Field(default=False, description="是否开启发送")
